import 'package:installed_apps/app_info.dart';
import 'package:installed_apps/installed_apps.dart';
import 'package:permission_handler/permission_handler.dart';

import 'base_handler.dart';

class InstalledAppsHandler extends BaseHandler {

  @override
  String name = "installedApps";

  @override
  void handler(dynamic data, dynamic responseCallback) async {
    // bool permission = await Permission.requestPackagePermissions.request().isGranted;
    // if(!permission) {
    //   return;
    // }
    List<AppInfo> apps = await InstalledApps.getInstalledApps(false, true);
    for (var value in apps) {
      print("${value.name}: ${value.packageName}");
    }
  }
}